<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    //   工厂函数
    function createPerson(name) {
      var o = {};
      o.name = name;
      o.getName = function () {
        console.log(this.name);
      };
    }
    var person = createPerson("heh1");
    person.getName();
  </script>
</html>
